package tests;

import datastucture.Calculator;
import junit.framework.Assert;
import junit.framework.TestCase;

public class CalculatorTest extends TestCase {
	private Calculator cal;

	public void setUp() {
		cal = new Calculator();
	}

	public void tearDown() {

	}

	public void testAdd() {
		int result = cal.add(1, 2);

		Assert.assertEquals(3, result);
	}

	public void testMinus() {
		int result = cal.minus(1, 2);
		Assert.assertEquals(-1, result);
	}

	public void testMultiply() {
		int result = cal.multiply(2, 3);
		Assert.assertEquals(6, result);
	}

	public void testDivide() {
		int result = 0;
		try {
			result = cal.divide(6, 4);
		} catch (Exception e) {
			e.printStackTrace();
			Assert.fail();
		}
		Assert.assertEquals(1, result);
	}
}
